package com.xg.sys.vo;

import com.xg.frame.validate.group.AddGroup;
import com.xg.frame.validate.group.StatusGroup;
import com.xg.frame.validate.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.List;

/**
 * @author tzt
 */
@Data
@ApiModel(value="SysMenuVO对象", description="菜单交互实体")
public class SysMenuVO {

    @NotNull(groups = {UpdateGroup.class, StatusGroup.class})
    @ApiModelProperty(value = "主键" )
    private Long id;

    @NotNull(groups = {AddGroup.class, UpdateGroup.class})
    @ApiModelProperty(value = "父菜单ID，一级菜单为0")
    private Long parentId;

    @ApiModelProperty(value = "父菜单名称")
    private String parentName;

    @NotBlank(groups = {AddGroup.class, UpdateGroup.class})
    @ApiModelProperty(value = "菜单名称")
    private String name;

    @ApiModelProperty(value = "菜单URL")
    private String url;

    @ApiModelProperty(value = "授权(多个用逗号分隔，如：user:list,user:create)")
    private String perms;

    @NotNull(groups = {UpdateGroup.class, AddGroup.class})
    @ApiModelProperty(value = "类型:100301-目录,100302-菜单",allowableValues = "0,1")
    private String type;

    @ApiModelProperty(value = "菜单图标")
    private String icon;
    
    @ApiModelProperty(value = "排序")
    private Integer orderNum;

    @NotBlank(groups = StatusGroup.class)
    @Pattern(groups = StatusGroup.class, regexp = "100101|100102", message = "{form.fixed.value}")
    @ApiModelProperty(value = "是否启用(启用：100101，未启用:100102)")
    private String status;

    @ApiModelProperty(value = "子菜单列表")
    private List<SysMenuVO> list;
}